/* $Header: config_tbls.c,v 2.2 01/10/02 10:29:13 przybyls Exp $ */

/* config_tbls.c - workfile get/set for config commands */
/* Lesley Freed; December 1992 */
/* John DeGood; April 1994 */
/* Copyright (c) 1992-1994, Hewlett-Packard Co. */

#include <typedefs.h>
#include <pcb_defs.h>
#include <error.h>
#include <p_wkfile.h>
#include <zone_config.h>
#include <method.h>
#include <stddef.h>
#include <p_status.h>
#include <p_ui.h>
#include <als_ui.h>
#include <meth_config.h>
#include <keyboard.h>

/********************* wrapper function prototypes *********************/

static UI_ERR DummyFunction(void *status);

static INT32 mGetMioBdPresence(void *status, U_INT8 num);
static INT32 mGetEpcBdPresence(void *status, U_INT8 num);

static INT32 mGetAlsPowerSupply(void *status, U_INT8 num);
static INT32 mGetFrAlsInjector(void *status, U_INT8 num);
static INT32 mGetBkAlsInjector(void *status, U_INT8 num);
static INT32 mGetAlsTray(void *status, U_INT8 num);
static INT32 mGetAlsHadPowerSupply(void *status, U_INT8 num);

static UI_ERR mLetMioBdPresence(void *status, INT32 setpt, U_INT8 num);
static UI_ERR mLetEpcBdPresence(void *status, INT32 setpt, U_INT8 num);

static UI_ERR mLetAlsPowerSupply(void *status, INT32 setpt, U_INT8 num);
static UI_ERR mLetFrAlsInjector(void *status, INT32 setpt, U_INT8 num);
static UI_ERR mLetBkAlsInjector(void *status, INT32 setpt, U_INT8 num);
static UI_ERR mLetAlsTray(void *status, INT32 setpt, U_INT8 num);
static UI_ERR mLetAlsHadPowerSupply(void *status, INT32 setpt, U_INT8 num);

PRESENCE IfLANInstalled(void);


static const METHCMD_ENTRY mmGCCW[] =
{
        {mGetMioBdPresence,     mLetMioBdPresence,      0,      METH_INT0},
        {mGetEpcBdPresence,     mLetEpcBdPresence,      0,      METH_INT0},
};

static const METHCMD_ENTRY mmASCW[] =
{
        {mGetAlsPowerSupply,    mLetAlsPowerSupply,     0,      METH_INT0},
        {mGetFrAlsInjector,     mLetFrAlsInjector,      0,      METH_INT0},
        {mGetBkAlsInjector,     mLetBkAlsInjector,      0,      METH_INT0},
        {mGetAlsTray,           mLetAlsTray,            0,      METH_INT0},
        {mGetAlsHadPowerSupply, mLetAlsHadPowerSupply,  0,      METH_INT0},
};

const METHCMD mGCCW =
{
        MAXINDEX(mmGCCW, METHCMD_ENTRY),
        &mmGCCW[0],
        (void *)NULL,
        DummyFunction,
        DummyFunction
};

const METHCMD mASCW =
{
        MAXINDEX(mmASCW, METHCMD_ENTRY),
        &mmASCW[0],
        (void *)NULL,
        DummyFunction,
        DummyFunction
};


static UI_ERR DummyFunction(void *which)
{
        (void) which;
        return OK;
}

static INT32 mGetMioBdPresence(void *status, U_INT8 num)
{
   (void) status;
   (void) num;
   if ( IfLANInstalled() == ACTIVE )
   {
      return TRUE;
   }
   else
   {
      return FALSE;
   }
}

static INT32 mGetAlsPowerSupply(void *status, U_INT8 num)
{
   (void) status;
   (void) num;
   return (INT32)HaveAlsPowerSupply();
}

static INT32 mGetFrAlsInjector(void *status, U_INT8 num)
{
   (void) status;
   (void) num;
   return (INT32)AnyFrAlsInjector();
}

static INT32 mGetBkAlsInjector(void *status, U_INT8 num)
{
   (void) status;
   (void) num;
   return (INT32)AnyBkAlsInjector();
}

static INT32 mGetAlsTray(void *status, U_INT8 num)
{
   (void) status;
   (void) num;
   return (INT32)AnyAlsTray();
}

static INT32 mGetAlsHadPowerSupply(void *status, U_INT8 num)
{
   (void) status;
   (void) num;
   return (INT32)TRUE;
}

static INT32 mGetEpcBdPresence(void *status, U_INT8 num)
{
   (void) status;
   (void) num;
   if ( IamAdirtball() ) return FALSE;
   return TRUE;
}

static UI_ERR mLetMioBdPresence (void *status, INT32 setpt, U_INT8 num)
{
   (void) status;
   (void) num;

   gccw.MioBdPresence = (BIT8)setpt;

   return OK;
}

static UI_ERR mLetAlsPowerSupply (void *status, INT32 setpt, U_INT8 num)
{
   (void) status;
   (void) num;

   gccw.AlsPowerSupply = (BIT8)setpt;

   return OK;
}

static UI_ERR mLetFrAlsInjector (void *status, INT32 setpt, U_INT8 num)
{
   (void) status;
   (void) num;

   gccw.AlsFrInjector = (BIT8)setpt;

   return OK;
}

static UI_ERR mLetBkAlsInjector (void *status, INT32 setpt, U_INT8 num)
{
   (void) status;
   (void) num;

   gccw.AlsBkInjector = (BIT8)setpt;

   return OK;
}

static UI_ERR mLetAlsTray (void *status, INT32 setpt, U_INT8 num)
{
   (void) status;
   (void) num;

   gccw.AlsTray = (BIT8)setpt;

   return OK;
}

static UI_ERR mLetAlsHadPowerSupply (void *status, INT32 setpt, U_INT8 num)
{
   (void) status;
   (void) num;

   gccw.AlsHadPowerSupply = (BIT8)setpt;

   return OK;
}

static UI_ERR mLetEpcBdPresence (void *status, INT32 setpt, U_INT8 num)
{
   (void) status;
   (void) num;

   gccw.EpcBdPresence = (BIT8)setpt;

   return OK;
}
